package com.zshield.run;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.lang3.StringUtils;

public class CmdLineParams {
	private static CommandLine line;
	
	public static void setLine(CommandLine line) {
		CmdLineParams.line = line;
	}

	public static String getBootstrapServer(){
		String bootstrap_server =line.getOptionValue("bootstrap_server");
		bootstrap_server = StringUtils.isBlank(bootstrap_server) ? "localhost:9092" : bootstrap_server;
		return bootstrap_server;
	}

	public static int getEsNumberOfReplica(){
		String number =line.getOptionValue("es_number_of_replica");
		int es_number_of_replica =StringUtils.isNotBlank(number)?Integer.parseInt(number):1;
		return es_number_of_replica;
	}

	public static String getEsHost (){
		String es_host =line.getOptionValue("es_host");
		es_host =StringUtils.isNotBlank(es_host)?es_host:"localhost";
		return es_host;
	}

	public static boolean getUpgrade (){
		return line.hasOption("upgrade");
	}

}
